import React, { Component } from 'react'
import connect from './store/connect'

class CountButton extends Component {
  render() {
    let txt = this.props.type === 'increment' ? '+' : '-'
    return (
      <button onClick={() => {
        if (this.props.type === 'increment') {
          this.props.inc()
        } else {
          this.props.dec()
        }
      }}>
        {txt}
      </button>
    )
  }
}

export default connect(CountButton)